/*******************************************************************************
 * Copyright (c) 2009 Dmitry Grushin <dgrushin@gmail.com>.
 * 
 * This file is part of GridMe.
 * 
 * GridMe is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * GridMe is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with GridMe.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contributors:
 *     Dmitry Grushin <dgrushin@gmail.com> - initial API and implementation
 ******************************************************************************/
package com.googlecode.gridme.runtime.schedule.impl;

import com.googlecode.gridme.runtime.schedule.GNode;

/**
 * Represents processor usage - parent node, [start, stop] time segment
 */
public class ProcSlot
{
  private final GNode node;
  private long start;
  private final long end;

  public ProcSlot(GNode node, long start, long duration)
  {
    super();
    this.node = node;
    this.start = start;
    this.end = start + duration;
  }

  public ProcSlot(GNode node, long start)
  {
    super();
    this.node = node;
    this.start = start;
    this.end = Long.MAX_VALUE;
  }
  
  public GNode getNode()
  {
    return node;
  }

  public long getStartTime()
  {
    return start;
  }

  public long getDuration()
  {
    return end - start;
  }
  
  public long getStopTime()
  {
    return end;
  }

  public void setStartTime(long start)
  {
    this.start = start;
  }
}
